﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Lamex.Base;
using DevExpress.XtraEditors;
using Lamex.Controls;
using DevExpress.XtraEditors;
using Lamex.SIESystemManager.UI;

namespace Lamex.SIESystemManager.ucControls
{
    /// <summary>
    /// 功能：自动加载控件
    /// 日期：2018-12-4
    /// jack
    /// </summary>

    public partial class ucAutoAddControls : UserControl
    {
        public string userName = "";
        public string createDate = "";
        public string DrawingNumber = "";
        public string strPartNumber = "";
        string strProcess = "";
        DataTable dt = null;
        //DataTable dtItems = null;


        public ucAutoAddControls()
        {
            InitializeComponent();
            int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            tableLayoutPanel1.Padding = new Padding(0, 0, vertScrollWidth, 0);

        }

        public void GetTableInfo()
        {
            dt = BaseBuildSql.GetDataSetBySql(@"SELECT
            A.name AS table_name,
            B.name AS column_name,
            C.value AS column_description
            FROM LamexMESManager.sys.tables A
            INNER JOIN LamexMESManager.sys.columns B ON B.object_id = A.object_id
            LEFT JOIN LamexMESManager. sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
            WHERE A.name = '" + ucTempTable + "'").Tables[0];
            //dtItems = BaseBuildSql.GetDataSetBySql(" select * from B_IE_Operation_Type where  1=1").Tables[0];

        }
        /// <summary>
        /// 加载数据项
        /// </summary>
        public bool ucScroll
        {
            get
            {
                return tableLayoutPanel1.AutoScroll;
            }
            set
            {
                this.tableLayoutPanel1.AutoScroll = value;
            }
        }
        /// <summary>
        /// 临时表名
        /// </summary>
        string _tempTable = "";
        [Description("临时表")]
        public string ucTempTable
        {
            get
            {
                return _tempTable;
            }
            set
            {
                this._tempTable = value;
            }
        }
        ///// <summary>
        ///// 临时表名
        ///// </summary>
        //string _ucProcessTable = "";
        //public string ucProcessTable
        //{
        //    get
        //    {
        //        return _ucProcessTable;
        //    }
        //    set
        //    {
        //        this._ucProcessTable = value;
        //    }
        //}

        /// <summary>
        /// 正式表
        /// </summary>
        string _keepTable = "";
        [Description("保存正式表")]

        public string ucKeepTable
        {
            get
            {
                return _keepTable;
            }
            set
            {
                this._keepTable = value;
            }
        }
        /// <summary>
        ///工序定义表B_IE_Operational_Definition
        /// </summary>
        string _poTable = "";
        [Description("工序定义表B_IE_Operational_Definition")]
        public string ucPOTable
        {
            get
            {
                return _poTable;
            }
            set
            {
                this._poTable = value;
            }
        }
        /// <summary>
        ///类型
        /// </summary>
        string _Type = "";
        [Description("区分标准,SJ,包装工时")]
        public string Type
        {
            get
            {
                return _Type;
            }
            set
            {
                this._Type = value;
            }
        }
        /// <summary>
        ///类型
        /// </summary>
        string _isFlag = "";
        [Description("1代表标准,2代表SJ,3代表组包装工时标识符")]
        public string IsFlag
        {
            get
            {
                return _isFlag;
            }
            set
            {
                this._isFlag = value;
            }
        }
        public void LoadBOMListImtes(string strNumber, ComboBoxEdit control, string DrawingNumber)
        {
            if (string.IsNullOrEmpty(ucTempTable))
            {
                XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                return;
            }
            strProcess = strNumber;
            this.DrawingNumber = DrawingNumber;
            DataSet ds = BaseBuildSql.GetDataSetBySql(@"select * from LamexMESManager.dbo." + ucPOTable + " where WORKSTATION_LIST= '" + strNumber + "' and ISNULL(OPERATIONAL_NAME,'')!=''");

            //if (ds.Tables[0].Rows.Count == 0)
            //{
            //    control.Enabled = false;
            //}

            tableLayoutPanel1.Controls.Clear();
            tableLayoutPanel1.AutoScroll = true;
            DynamicLayout(tableLayoutPanel1, ds.Tables[0].Rows.Count, 2);
            int i = 1;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {

                if (dr["TYPE"].ToString().ToLower() == "a")
                {

                    DataRow drow = dt.Select(" column_description='" + strNumber + "_" + dr["OPERATIONAL_NAME"].ToString() + "'").FirstOrDefault();
                    ucComboBoxEdit tx = new ucComboBoxEdit();
                    if (drow != null)
                    {
                        //DataTable dtType = BaseBuildSql.GetDataSetBySql(" select * from B_IE_Operation_Type where  NUMBER='" + strNumber + "' and TYPE='" + dr["OPERATIONAL_NAME"].ToString() + "'").Tables[0];
                        //DataRow[] drows = dtItems.Select("NUMBER = '" + strNumber + "' and TYPE = '" + dr["OPERATIONAL_NAME"].ToString() + "'");

                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        //tx.Anchor = AnchorStyles.Left;
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();

                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcSelectedValueChanged += new EventHandler(tx_SelectedValueChanged);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);



                        if (!string.IsNullOrEmpty(dr["OPTION_VALUES"].ToString()))
                        {
                            string[] strArr = dr["OPTION_VALUES"].ToString().Split(',');
                            tx.Properties.DropDownRows = strArr.Count();
                            foreach (string s in strArr)
                            {
                                tx.Properties.Items.Add(s);
                            }

                        }
                        //foreach (int m = 0; m < 3; m++)
                        //{
                        //    tx.Properties.Items.Add(m);
                        //}
                        Label lb = new Label();
                        lb.BackColor = Color.AliceBlue;
                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.No;
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                else if (dr["TYPE"].ToString().ToLower() == "b")
                {
                    DataRow drow = dt.Select(" column_description='" + strNumber + "_" + dr["OPERATIONAL_NAME"].ToString() + "'").FirstOrDefault();
                    ucTextEdit tx = new ucTextEdit();
                    if (drow != null)
                    {

                        //tx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tx_MouseClick);
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();
                        //tx.Anchor = AnchorStyles.Left;
                        //tx.TypeList = 1;
                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        tx.TypeList = Lamex.Controls.ucTextEdit.ComboxListEdit.Int;
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);


                        Label lb = new Label();
                        lb.BackColor = Color.Aqua;

                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.Yes;
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                else if (dr["TYPE"].ToString().ToLower() == "c")
                {
                    DataRow drow = dt.Select(" column_description='" + strNumber + "_" + dr["OPERATIONAL_NAME"].ToString() + "'").FirstOrDefault();
                    ucTextEdit tx = new ucTextEdit();
                    if (drow != null)
                    {

                        //tx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tx_MouseClick);
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();
                        //tx.Anchor = AnchorStyles.Left;
                        //tx.TypeList = "Int";
                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        tx.TypeList = Lamex.Controls.ucTextEdit.ComboxListEdit.Int;
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);

                        Label lb = new Label();
                        lb.BackColor = Color.YellowGreen;
                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.No;
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                i++;

            }
            Label lbs = new Label();
            lbs.Font = new Font("Tahoma", 8);
            lbs.Text = "";
            lbs.AutoSize = false;
            lbs.Dock = DockStyle.None;
            lbs.RightToLeft = RightToLeft.No;
            lbs.TextAlign = ContentAlignment.MiddleRight;
            lbs.Anchor = AnchorStyles.Right;
            tableLayoutPanel1.Controls.Add(lbs, 0, i);
        }
        public void LoadListImtes(string strNumber, TextEdit control, string DrawingNumber)
        {
            if (string.IsNullOrEmpty(ucTempTable))
            {
                XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                return;
            }
            strProcess = strNumber;
            this.DrawingNumber = DrawingNumber;

           

            DataSet ds = new DataSet();
            if (strNumber != "")
            {
                //if (strNumber == "D11")
                //{
                //    string Operation = "'P锯片槽长度','P锯片槽宽度','P锯片槽数量','P锣拉手孔','P锣锁档片孔','P异形锣长度'";
                //    ds = BaseBuildSql.GetDataSetBySql(@"select * from LamexMESManager.dbo." + ucPOTable + " where WORKSTATION_LIST like '%" + strNumber + "%' and OPERATIONAL_NAME in ("+Operation+") order by [TYPE]");
                //}
                //else
                ds = BaseBuildSql.GetDataSetBySql(@"select * from LamexMESManager.dbo." + ucPOTable + " where WORKSTATION_LIST like '%" + strNumber + "%' and ISNULL(OPERATIONAL_NAME,'')!='' order by [TYPE]");
            }
            else
            {
                ds = BaseBuildSql.GetDataSetBySql(@"select * from LamexMESManager.dbo." + ucPOTable + " where WORKSTATION_LIST = '" + strNumber + "' and ISNULL(OPERATIONAL_NAME,'')!='' order by [TYPE]");
            }

            if (ds.Tables[0].Rows.Count == 0)
            {
                control.Enabled = false;
            }

            tableLayoutPanel1.Controls.Clear();
            tableLayoutPanel1.AutoScroll = true;
            DynamicLayout(tableLayoutPanel1, ds.Tables[0].Rows.Count, 2);
            int i = 1;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {

                if (dr["TYPE"].ToString().ToLower() == "a")
                {

                    DataRow drow = dt.Select(" column_description='" + dr["OPERATIONAL_NAME"].ToString() + "' and column_name like '%" + strNumber + "%'").FirstOrDefault();
                    ucComboBoxEdit tx = new ucComboBoxEdit();
                    if (drow != null)
                    {
                        //DataTable dtType = BaseBuildSql.GetDataSetBySql(" select * from B_IE_Operation_Type where  NUMBER='" + strNumber + "' and TYPE='" + dr["OPERATIONAL_NAME"].ToString() + "'").Tables[0];
                        //DataRow[] drows = dtItems.Select("NUMBER = '" + strNumber + "' and TYPE = '" + dr["OPERATIONAL_NAME"].ToString() + "'");

                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        //tx.Anchor = AnchorStyles.Left;
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();
                        tx.UcTextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcSelectedValueChanged += new EventHandler(tx_SelectedValueChanged);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);



                        if (!string.IsNullOrEmpty(dr["OPTION_VALUES"].ToString()))
                        {
                            string[] strArr = dr["OPTION_VALUES"].ToString().Split(',');
                            tx.Properties.DropDownRows = strArr.Count();
                            foreach (string s in strArr)
                            {
                                tx.Properties.Items.Add(s);
                            }

                        }
                        //foreach (int m = 0; m < 3; m++)
                        //{
                        //    tx.Properties.Items.Add(m);
                        //}
                        Label lb = new Label();
                        lb.BackColor = Color.AliceBlue;
                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.Yes;//No
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                else if (dr["TYPE"].ToString().ToLower() == "b")
                {
                    DataRow drow = dt.Select(" column_description='" + dr["OPERATIONAL_NAME"].ToString() + "' and column_name like '%" + strNumber + "%'").FirstOrDefault();
                    ucTextEdit tx = new ucTextEdit();
                   // TextEdit tx = new TextEdit();
                    if (drow != null)
                    {
                        //tx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tx_MouseClick);
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();
                        //tx.Anchor = AnchorStyles.Left;
                        //tx.TypeList = 1;
                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        tx.TypeList = Lamex.Controls.ucTextEdit.ComboxListEdit.Int;
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);

                     


                        Label lb = new Label();
                        lb.BackColor = Color.Aqua;

                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.Yes;
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                else if (dr["TYPE"].ToString().ToLower() == "c")
                {

                   
                    DataRow drow = dt.Select(" column_description='" + dr["OPERATIONAL_NAME"].ToString() + "' and column_name like '%" + strNumber + "%'").FirstOrDefault();

                    ucTextEdit tx = new ucTextEdit();
                    if (drow != null)
                    {

                        //tx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tx_MouseClick);
                        tx.ToolTips = dr["DESCRIPTION"].ToString().ToLower();
                        //tx.Anchor = AnchorStyles.Left;
                        //tx.TypeList = "Int";
                        tx.Caption = "";
                        tx.CaptionWidth = 0;
                        tx.Dock = System.Windows.Forms.DockStyle.Fill;
                        tx.Name = drow["column_name"].ToString();
                        tx.TabIndex = i;
                        tx.TypeList = Lamex.Controls.ucTextEdit.ComboxListEdit.Int;
                        
                        //tx.Leave += new EventHandler(tx_Leave);
                        tx.UcMouseLeaves += new EventHandler(tx_MouseLeave);
                        tx.UcTextChanged += new EventHandler(tx_UcTextChanged);

                        Label lb = new Label();
                        lb.BackColor = Color.YellowGreen;
                        lb.Font = new Font("Tahoma", 8);
                        lb.Text = dr["OPERATIONAL_NAME"].ToString().Trim();
                        lb.AutoSize = false;
                        lb.Dock = DockStyle.None;
                        lb.Anchor = AnchorStyles.Left;
                        lb.RightToLeft = RightToLeft.Yes;//No
                        lb.TextAlign = ContentAlignment.MiddleRight;
                        tableLayoutPanel1.Controls.Add(lb, 0, i);
                        this.tableLayoutPanel1.Controls.Add(tx, 1, i);
                    }
                }
                i++;

            }
            Label lbs = new Label();
            lbs.Font = new Font("Tahoma", 8);
            lbs.Text = "";
            lbs.AutoSize = false;
            lbs.Dock = DockStyle.None;
            lbs.RightToLeft = RightToLeft.No;
            lbs.TextAlign = ContentAlignment.MiddleRight;
            lbs.Anchor = AnchorStyles.Right;
            tableLayoutPanel1.Controls.Add(lbs, 0, i);
        }
        private void tx_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where 1=1 and DRAWING_NUMBER='" + DrawingNumber + "'").Tables[0];

                string filedName = "";
                string filedText = "";
                if (dttemp.Rows.Count == 0)
                {

                    string strFiled = "";
                    string filedValue = "";
                    string sql = "";

                    if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        strFiled += c.Name + ",";
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            filedValue += "NULL" + ",";
                        }
                        else
                        {
                            filedValue += "'" + c.Text + "'" + ",";
                        }
                        filedText = c.Text;
                    }



                    strFiled += "DRAWING_NUMBER" + ",";
                    if (string.IsNullOrEmpty(DrawingNumber))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + DrawingNumber + "'" + ",";


                    strFiled = strFiled.Trim(',');
                    filedValue = filedValue.Trim(',');
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = " INSERT INTO [LamexMESManager].[dbo]." + ucTempTable + " ( " + strFiled + " ) Values ( " + filedValue + " ) ";
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }

                }
                else
                {

                    string strFiled = "";
                    string sql = "";

                    string tableName = "[LamexMESManager].[dbo]." + ucTempTable;
                    if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        filedText = c.Text;
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            string name = "0";
                            strFiled += string.Format("{0}='{1}',", c.Name, name);
                        }
                        else
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                    }

                    strFiled = strFiled.Trim(',');
                    string drawNumberField = "DRAWING_NUMBER";
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' ", tableName, strFiled, drawNumberField, DrawingNumber);
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }
                }

            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }

        private void tx_MouseLeave(object sender, EventArgs e)
        {
            try
            {
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where 1=1 and DRAWING_NUMBER='" + DrawingNumber + "'").Tables[0];

                string filedName = "";
                string filedText = "";
                if (dttemp.Rows.Count == 0)
                {

                    string strFiled = "";
                    string filedValue = "";
                    string sql = "";

                    if (sender is ucTextEdit)
                    {
                        ucTextEdit c = sender as ucTextEdit;
                        strFiled += c.Name + ",";
                        filedName = c.Name;
                        if (string.IsNullOrEmpty(c.Text))
                            filedValue += "NULL" + ",";
                        else
                            filedValue += "'" + c.Text + "'" + ",";
                        filedText = c.Text;
                    }
                    else if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        strFiled += c.Name + ",";
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            filedValue += "NULL" + ",";

                        }
                        else
                        {
                            filedValue += "'" + c.Text + "'" + ",";

                        }
                        filedText = c.Text;
                    }



                    strFiled += "DRAWING_NUMBER" + ",";
                    if (string.IsNullOrEmpty(DrawingNumber))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + DrawingNumber + "'" + ",";


                    strFiled = strFiled.Trim(',');
                    filedValue = filedValue.Trim(',');
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = " INSERT INTO [LamexMESManager].[dbo]." + ucTempTable + " ( " + strFiled + " ) Values ( " + filedValue + " ) ";
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }

                }
                else
                {

                    string strFiled = "";
                    string sql = "";

                    string tableName = "[LamexMESManager].[dbo]." + ucTempTable;
                    if (sender is ucTextEdit)
                    {
                        ucTextEdit c = sender as ucTextEdit;
                        filedName = c.Name;
                        filedText = c.Text;
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            string name = "0";
                            strFiled += string.Format("{0}='{1}',", c.Name, name);
                        }
                        else
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);

                    }
                    else if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        filedText = c.Text;
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            string name = "0";
                            strFiled += string.Format("{0}='{1}',", c.Name, name);
                        }
                        else
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                    }

                    strFiled = strFiled.Trim(',');
                    string drawNumberField = "DRAWING_NUMBER";
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' ", tableName, strFiled, drawNumberField, DrawingNumber);
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }
                }

            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }

        }
        private void tx_UcTextChanged(object sender, EventArgs e)
        {
            try
            {
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where 1=1 and DRAWING_NUMBER='" + DrawingNumber + "'").Tables[0];

                string filedName = "";
                string filedText = "";
                if (dttemp.Rows.Count == 0)
                {

                    string strFiled = "";
                    string filedValue = "";
                    string sql = "";

                    if (sender is ucTextEdit)
                    {
                        ucTextEdit c = sender as ucTextEdit;
                        filedName = c.Name;
                        strFiled += c.Name + ",";
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            filedValue += "NULL" + ",";
                        }
                        else
                        {
                            filedValue += "'" + c.Text + "'" + ",";
                        }
                        filedText = c.Text;
                    }
                    else if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        strFiled += c.Name + ",";
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            filedValue += "NULL" + ",";

                        }
                        else
                        {
                            filedValue += "'" + c.Text + "'" + ",";

                        }
                        filedText = c.Text;
                    }


                    strFiled += "DRAWING_NUMBER" + ",";
                    if (string.IsNullOrEmpty(DrawingNumber))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + DrawingNumber + "'" + ",";


                    strFiled = strFiled.Trim(',');
                    filedValue = filedValue.Trim(',');
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = " INSERT INTO [LamexMESManager].[dbo]." + ucTempTable + " ( " + strFiled + " ) Values ( " + filedValue + " ) ";
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }

                }
                else
                {

                    string strFiled = "";
                    string sql = "";

                    string tableName = "[LamexMESManager].[dbo]." + ucTempTable;
                    if (sender is ucTextEdit)
                    {
                        ucTextEdit c = sender as ucTextEdit;
                        filedName = c.Name;
                        filedText = c.Text;
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            string name = "0";
                            strFiled += string.Format("{0}='{1}',", c.Name, name);
                        }
                        else
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                    }
                    else if (sender is ucComboBoxEdit)
                    {
                        ucComboBoxEdit c = sender as ucComboBoxEdit;
                        filedName = c.Name;
                        filedText = c.Text;
                        if (string.IsNullOrEmpty(c.Text))
                        {
                            string name = "0";
                            strFiled += string.Format("{0}='{1}',", c.Name, name);
                        }
                        else
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                    }
                    strFiled = strFiled.Trim(',');
                    string drawNumberField = "DRAWING_NUMBER";
                    if (!string.IsNullOrEmpty(strFiled))
                    {
                        sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' ", tableName, strFiled, drawNumberField, DrawingNumber);
                        BaseBuildSql.ExecuteNonQuery(sql);
                    }
                }

            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
        private void tx_Leave(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 动态布局
        /// </summary>
        /// <param name="layoutPanel">布局面板</param>
        /// <param name="row">行</param>
        /// <param name="col">列</param>
        private void DynamicLayout(TableLayoutPanel layoutPanel, int row, int col)
        {

            layoutPanel.RowCount = row;
            for (int i = 0; i < row; i++)
            {
                layoutPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize, 23));
            }

            //layoutPanel.ColumnCount = col;    //设置分成几列
            //for (int i = 0; i < col; i++)
            //{
            //    //if(i==0)
            //        layoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 100));
            //    //else if(i==1)
            //    //    layoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            //}
        }
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="DrawNumber"></param>
        /// <param name="CreateBy"></param>
        /// <param name="CreateDate"></param>
        /// <param name="Flags"></param>
        /// <returns></returns>
        public void LoadData(string DrawNumber, string CreateBy, string CreateDate, string Flags, TextEdit control, string Flag)
        {
            if (string.IsNullOrEmpty(ucTempTable))
            {
                XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                return;
            }

            if (tableLayoutPanel1.ColumnCount == 2)
            {
                DataTable dttemp = null;
                if (!string.IsNullOrEmpty(Flag))
                    dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo.B_IE_Operation_Data_Temp  where DRAWING_NUMBER like '%" + DrawNumber + "%' ").Tables[0];
                else
                    dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where DRAWING_NUMBER like '%" + DrawNumber + "%' ").Tables[0];
                if (dttemp.Rows.Count != 0)
                {
                    foreach (Control c in tableLayoutPanel1.Controls)
                    {

                        foreach (DataColumn col in dttemp.Columns)
                        {
                            if (c.Name == col.ColumnName)
                            {
                                if (!string.IsNullOrEmpty(dttemp.Rows[0][col.ColumnName].ToString()))
                                {
                                    if (c is ucTextEdit)
                                    {
                                        if (dttemp.Rows[0][col.ColumnName].ToString() == "0") c.Text = "";
                                        else c.Text = dttemp.Rows[0][col.ColumnName].ToString();
                                        control.BackColor = Color.GreenYellow;
                                    }
                                    else
                                    {
                                        c.Text = dttemp.Rows[0][col.ColumnName].ToString();
                                        control.BackColor = Color.GreenYellow;
                                    }

                                }

                            }
                        }
                    }
                }
            }

        }

        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="DrawNumber"></param>
        /// <param name="CreateBy"></param>
        /// <param name="CreateDate"></param>
        /// <param name="Flags"></param>
        /// <returns></returns>
        public void LoadDataType(string DrawNumber, string CreateBy, string CreateDate, string strProcess, TextEdit control)
        {
            if (string.IsNullOrEmpty(ucTempTable))
            {
                XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                return;
            }

            if (tableLayoutPanel1.ColumnCount == 2)
            {
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where DRAWING_NUMBER='" + DrawNumber + "' ").Tables[0];
                DataRow[] drs = dt.Select(" column_name like '%" + strProcess + "%'");
                if (drs.Count() == 0) control.Enabled = false;
                if (dttemp.Rows.Count != 0)
                {
                    foreach (DataRow dr in drs)
                    {

                        foreach (DataColumn col in dttemp.Columns)
                        {
                            if (dr["column_name"].ToString() == col.ColumnName)
                            {
                                if (!string.IsNullOrEmpty(dttemp.Rows[0][col.ColumnName].ToString()))
                                {
                                    string isFlag = "";
                                    if (dttemp.Rows[0][col.ColumnName].ToString() != "0")
                                    {
                                        control.BackColor = Color.GreenYellow;
                                    }


                                    //if (c is ucTextEdit)
                                    //{
                                    //    if (dttemp.Rows[0][col.ColumnName].ToString() == "0") c.Text = "";
                                    //    else c.Text = dttemp.Rows[0][col.ColumnName].ToString();
                                    //    control.BackColor = Color.GreenYellow;
                                    //}
                                    //else
                                    //{
                                    //    c.Text = dttemp.Rows[0][col.ColumnName].ToString();
                                    //    control.BackColor = Color.GreenYellow;
                                    //}

                                }

                            }
                        }
                    }
                }
            }

        }

        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="DrawNumber"></param>
        /// <param name="CreateBy"></param>
        /// <param name="CreateDate"></param>
        /// <param name="Flags"></param>
        /// <returns></returns>
        public int ReturnValue(string DrawNumber, string CreateBy, string CreateDate, string strProcess, TextEdit control)
        {
            if (string.IsNullOrEmpty(ucTempTable))
            {
                XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                return 0;
            }
            int retruvalue = 0;
            if (tableLayoutPanel1.ColumnCount == 2)
            {
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where DRAWING_NUMBER='" + DrawNumber + "' ").Tables[0];
                DataRow[] drs = dt.Select(" column_name like '%" + strProcess + "%'");
                if (drs.Count() == 0) control.Enabled = false;
                if (dttemp.Rows.Count != 0)
                {
                    foreach (DataRow dr in drs)
                    {

                        foreach (DataColumn col in dttemp.Columns)
                        {
                            if (dr["column_name"].ToString() == col.ColumnName)
                            {
                                if (!string.IsNullOrEmpty(dttemp.Rows[0][col.ColumnName].ToString()))
                                {
                                    string isFlag = "";
                                    if (dttemp.Rows[0][col.ColumnName].ToString() != "")
                                    {
                                        if (!dttemp.Rows[0][col.ColumnName].ToString().Contains("0"))
                                            retruvalue = 1;

                                    }

                                }

                            }
                        }
                    }
                }
            }
            return retruvalue;
        }
        /// <summary>
        /// 临时数据保存
        /// </summary>

        public void Save(string DrawNumber, string CreateBy, string CreateDate, string Flags, TextEdit control)
        {
            try
            {
                //DataTable dt = DbHelperSQL.Query("select * from [LamexMESManager].[dbo].B_IE_Operation_Data where DRAWING_NUMBER='" + DrawNumber + "' and FLAG='" + Flags + "'").Tables[0];
                if (string.IsNullOrEmpty(ucTempTable))
                {
                    XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                    return;
                }
                int m = 0;
                //if (dt.Rows.Count == 0)
                //{
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where DRAWING_NUMBER='" + DrawNumber + "'").Tables[0];

                if (dttemp.Rows.Count == 0)
                {
                    string strFiled = "";
                    string filedValue = "";
                    string sql = "";
                    foreach (Control c in tableLayoutPanel1.Controls)
                    {


                        if (c is ucTextEdit)
                        {
                            strFiled += c.Name + ",";
                            if (string.IsNullOrEmpty(c.Text))
                                filedValue += "NULL" + ",";
                            else
                                filedValue += "'" + c.Text + "'" + ",";
                        }
                        else if (c is ucComboBoxEdit)
                        {

                            strFiled += c.Name + ",";
                            if (string.IsNullOrEmpty(c.Text))
                                filedValue += "NULL" + ",";
                            else
                                filedValue += "'" + c.Text + "'" + ",";
                        }


                    }
                    strFiled += "DRAWING_NUMBER" + ",";
                    if (string.IsNullOrEmpty(DrawNumber))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + DrawNumber + "'" + ",";

                    strFiled += "CREATE_USER" + ",";
                    if (string.IsNullOrEmpty(CreateBy))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + CreateBy + "'" + ",";

                    strFiled += "CREATE_DATE" + ",";
                    if (string.IsNullOrEmpty(CreateDate))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + CreateDate + "'" + ",";

                    strFiled += "FLAG" + ",";
                    if (string.IsNullOrEmpty(Flags))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + Flags + "'" + ",";
                    strFiled = strFiled.Trim(',');
                    filedValue = filedValue.Trim(',');

                    sql = " INSERT INTO [LamexMESManager].[dbo]." + ucTempTable + " ( " + strFiled + " ) Values ( " + filedValue + " ) ";
                    m = BaseBuildSql.ExecuteNonQuery(sql);
                    if (m > 0) control.BackColor = Color.GreenYellow;
                }
                else
                {
                    string strFiled = "";
                    string sql = "";
                    string tableName = "[LamexMESManager].[dbo]." + ucTempTable;
                    foreach (Control c in tableLayoutPanel1.Controls)
                    {
                        if (c is ucTextEdit)
                        {
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                        }
                        else if (c is ucComboBoxEdit)
                        {
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                        }
                    }
                    strFiled = strFiled.Trim(',');
                    string drawNumberField = "DRAWING_NUMBER";
                    string flagsField = "FLAG";
                    sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' ", tableName, strFiled, drawNumberField, DrawNumber);
                    m = BaseBuildSql.ExecuteNonQuery(sql);
                    if (m > 0) control.BackColor = Color.GreenYellow;
                }

                //}
                //else
                //{
                //    string strFiled = "";
                //    string sql = "";
                //    string tableName = "[LamexMESManager].[dbo]."+ucKeepTable;
                //    foreach (Control c in tableLayoutPanel1.Controls)
                //    {
                //        if (c is ucTextEdit)
                //        {
                //            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                //        }
                //        else if (c is ucComboBoxEdit)
                //        {
                //            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                //        }
                //    }
                //    strFiled = strFiled.Trim(',');
                //    string drawNumberField = "DRAWING_NUMBER";
                //    string flagsField = "FLAG";
                //    sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' and {4}='{5}'", ucKeepTable, strFiled, drawNumberField, DrawNumber, flagsField, Flags);
                //    m = DbHelperSQL.ExecuteSql(sql);
                //    if (m > 0) control.UcBackColor = Color.GreenYellow;
                //}
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }

        }
        /// <summary>
        /// 光标离数据保存
        /// </summary>

        public void MouseLeaveSave(string DrawNumber, string CreateBy, string CreateDate, string Flags, TextEdit control)
        {
            try
            {
                if (string.IsNullOrEmpty(ucTempTable))
                {
                    XtraMessageBox.Show("属性ucTempTable上没有设置保存的表名称");
                    return;
                }
                int m = 0;
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from LamexMESManager.dbo." + ucTempTable + "  where DRAWING_NUMBER='" + DrawNumber + "'").Tables[0];

                if (dttemp.Rows.Count == 0)
                {
                    string strFiled = "";
                    string filedValue = "";
                    string sql = "";
                    foreach (Control c in tableLayoutPanel1.Controls)
                    {


                        if (c is ucTextEdit)
                        {
                            strFiled += c.Name + ",";
                            if (string.IsNullOrEmpty(c.Text))
                                filedValue += "NULL" + ",";
                            else
                                filedValue += "'" + c.Text + "'" + ",";
                        }
                        else if (c is ucComboBoxEdit)
                        {

                            strFiled += c.Name + ",";
                            if (string.IsNullOrEmpty(c.Text))
                                filedValue += "NULL" + ",";
                            else
                                filedValue += "'" + c.Text + "'" + ",";
                        }


                    }
                    strFiled += "DRAWING_NUMBER" + ",";
                    if (string.IsNullOrEmpty(DrawNumber))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + DrawNumber + "'" + ",";

                    strFiled += "CREATE_USER" + ",";
                    if (string.IsNullOrEmpty(CreateBy))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + CreateBy + "'" + ",";

                    strFiled += "CREATE_DATE" + ",";
                    if (string.IsNullOrEmpty(CreateDate))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + CreateDate + "'" + ",";

                    strFiled += "FLAG" + ",";
                    if (string.IsNullOrEmpty(Flags))
                        filedValue += "NULL" + ",";
                    else
                        filedValue += "'" + Flags + "'" + ",";
                    strFiled = strFiled.Trim(',');
                    filedValue = filedValue.Trim(',');

                    sql = " INSERT INTO [LamexMESManager].[dbo]." + ucTempTable + " ( " + strFiled + " ) Values ( " + filedValue + " ) ";
                    BaseBuildSql.ExecuteNonQuery(sql);
                }
                else
                {
                    string strFiled = "";
                    string sql = "";
                    string tableName = "[LamexMESManager].[dbo]." + ucTempTable;
                    foreach (Control c in tableLayoutPanel1.Controls)
                    {
                        if (c is ucTextEdit)
                        {
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                        }
                        else if (c is ucComboBoxEdit)
                        {
                            strFiled += string.Format("{0}='{1}',", c.Name, c.Text);
                        }
                    }
                    strFiled = strFiled.Trim(',');
                    string drawNumberField = "DRAWING_NUMBER";
                    string flagsField = "FLAG";
                    sql = string.Format("UPDATE {0} set {1} WHERE {2} ='{3}' ", tableName, strFiled, drawNumberField, DrawNumber);
                    BaseBuildSql.ExecuteNonQuery(sql);
                    //if (m > 0) control.BackColor = Color.GreenYellow;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }

        }
        /// <summary>
        /// 保存正式表
        /// </summary>
        public bool SaveAllList(string DrawNumber, List<string> strProcessList)
        {
            try
            {
                if (string.IsNullOrEmpty(ucKeepTable))
                {
                    XtraMessageBox.Show("属性ucKeepTable上没有设置保存的表名称");
                    return false;
                }
                string rountingGroup = "";
                if (!strProcessList.Contains("SJPL"))
                {
                    strProcessList.Sort();                
                    foreach (string str in strProcessList)
                    {
                        if (!string.IsNullOrEmpty(str))
                            rountingGroup += "-" + str;
                    }
                    //if(string.IsNullOrEmpty(rountingGroup))
                    rountingGroup = rountingGroup.Substring(1, rountingGroup.Length - 1);
                    frmBIEShowList frm = new frmBIEShowList(DrawNumber, ucTempTable, strProcessList);
                    frm.ShowDialog();
                    DialogResult dialogResult = frm.dialogResult;
                    if (DialogResult.No == dialogResult) return false;
                }
                DataTable dttemp = BaseBuildSql.GetDataSetBySql("select * from [LamexMESManager].[dbo]." + ucKeepTable + " where DRAWING_NUMBER='" + DrawNumber + "' ").Tables[0];
                DataTable dt = BaseBuildSql.GetDataSetBySql("select * from [LamexMESManager].[dbo]." + ucTempTable + " where DRAWING_NUMBER='" + DrawNumber + "' ").Tables[0];
                BaseBuildSql.ExecuteNonQuery("DELETE from[LamexMESManager].[dbo]." + ucKeepTable + " where DRAWING_NUMBER = '" + DrawNumber + "' ");
                if (dt.Rows.Count != 0)
                {
                    //if (dttemp.Rows.Count != 0)
                    //{
                    //    BaseBuildSql.ExecuteNonQuery("DELETE from[LamexMESManager].[dbo]." + ucKeepTable + " where DRAWING_NUMBER = '" + DrawNumber + "' ");
                    //}
                    if (Type != "GropPackage")
                    {
                        string sql = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
                     )
                     SELECT 
                      [DRAWING_NUMBER]
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
      ,'" + IsFlag + @"'
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
                      FROM LamexMESManager.[dbo]." + ucTempTable + " WHERE DRAWING_NUMBER='" + DrawNumber + "';";
                        string sql2 = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data_HiStoryRecord] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
      ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
                     )
                     SELECT 
                      [DRAWING_NUMBER] 
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
     ,'" + IsFlag + @"'
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
      ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
                      FROM LamexMESManager.[dbo]." + ucTempTable + " WHERE DRAWING_NUMBER='" + DrawNumber + "';";
                        string sql3 = "";
                        if (Type != "SJ")
                            sql3 = @"update B_IE_SJData_Import set Flag=1,CREATE_TIME=GETDATE(),locked=0 where DRAWING_NO_STANDARD='" + DrawNumber + "'";
                        else
                            sql3 = @"update [LamexMESManager].[dbo].[B_IE_SJR_DATA] set Flag=1 where PartNo='" + DrawNumber + "'";
                        sql = sql + sql2 + sql3;
                        int m = BaseBuildSql.ExecuteNonQuery(sql);

                        if (m > 0)
                        {
                            //XtraMessageBox.Show("保存成功！");
                            return true;

                        }
                        else
                        {
                           // XtraMessageBox.Show("保存失败！");
                            return false;
                        }
                    }
                    else
                    {
                        //grouppackage
                        string sql = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[D44_Barrel_Type]
      ,[D44_Drawers_Qty]
      ,[D47_Drawers_Qty]
      ,[D47_Sheet_Matal_500]
      ,[D47_Sheet_Matal_501_1300]
      ,[D47_Sheet_Matal_1301]
      ,[D47_Pulling_Door_Fittings]
      ,[D47_Install_Door_Fittings]
      ,[D47_Twisting_Diamond_Needle_Rings]
      ,[D47_Lock_Screws_Qty]
      ,[D47_Kind_of_Kitting]
      ,[D47_Special_Fittings_10]
      ,[D47_Special_Fittings_30]
      ,[D47_Special_Fittings_50]
      ,[D51_PEFilmPackaging]
      ,[D51_CartonPackaging]
      ,[D51_PaperPackaging]
      ,[D51_BoardPackaging]
      ,[D51_Board_Qty]
      ,[D54_Kind_of_Kitting]
                     )
                     SELECT 
                      [DRAWING_NUMBER]
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
      ,'" + IsFlag + @"'
      ,'" + rountingGroup + @"'
    ,[D44_Barrel_Type]
      ,[D44_Drawers_Qty]
      ,[D47_Drawers_Qty]
      ,[D47_Sheet_Matal_500]
      ,[D47_Sheet_Matal_501_1300]
      ,[D47_Sheet_Matal_1301]
      ,[D47_Pulling_Door_Fittings]
      ,[D47_Install_Door_Fittings]
      ,[D47_Twisting_Diamond_Needle_Rings]
      ,[D47_Lock_Screws_Qty]
      ,[D47_Kind_of_Kitting]
      ,[D47_Special_Fittings_10]
      ,[D47_Special_Fittings_30]
      ,[D47_Special_Fittings_50]
      ,[D51_PEFilmPackaging]
      ,[D51_CartonPackaging]
      ,[D51_PaperPackaging]
      ,[D51_BoardPackaging]
      ,[D51_Board_Qty]
      ,[D54_Kind_of_Kitting]
                      FROM LamexMESManager.[dbo]." + ucTempTable + " WHERE DRAWING_NUMBER='" + DrawNumber + "';";
                        string sql2 = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data_HiStoryRecord] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[D44_Barrel_Type]
      ,[D44_Drawers_Qty]
      ,[D47_Drawers_Qty]
      ,[D47_Sheet_Matal_500]
      ,[D47_Sheet_Matal_501_1300]
      ,[D47_Sheet_Matal_1301]
      ,[D47_Pulling_Door_Fittings]
      ,[D47_Install_Door_Fittings]
      ,[D47_Twisting_Diamond_Needle_Rings]
      ,[D47_Lock_Screws_Qty]
      ,[D47_Kind_of_Kitting]
      ,[D47_Special_Fittings_10]
      ,[D47_Special_Fittings_30]
      ,[D47_Special_Fittings_50]
      ,[D51_PEFilmPackaging]
      ,[D51_CartonPackaging]
      ,[D51_PaperPackaging]
      ,[D51_BoardPackaging]
      ,[D51_Board_Qty]
      ,[D54_Kind_of_Kitting]
                     )
                     SELECT 
                      [DRAWING_NUMBER] 
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
     ,'" + IsFlag + @"'
     ,'" + rountingGroup + @"'
     
      ,[D44_Barrel_Type]
      ,[D44_Drawers_Qty]
      ,[D47_Drawers_Qty]
      ,[D47_Sheet_Matal_500]
      ,[D47_Sheet_Matal_501_1300]
      ,[D47_Sheet_Matal_1301]
      ,[D47_Pulling_Door_Fittings]
      ,[D47_Install_Door_Fittings]
      ,[D47_Twisting_Diamond_Needle_Rings]
      ,[D47_Lock_Screws_Qty]
      ,[D47_Kind_of_Kitting]
      ,[D47_Special_Fittings_10]
      ,[D47_Special_Fittings_30]
      ,[D47_Special_Fittings_50]
      ,[D51_PEFilmPackaging]
      ,[D51_CartonPackaging]
      ,[D51_PaperPackaging]
      ,[D51_BoardPackaging]
      ,[D51_Board_Qty]
      ,[D54_Kind_of_Kitting]
                      FROM LamexMESManager.[dbo]." + ucTempTable + " WHERE DRAWING_NUMBER='" + DrawNumber + "';";
                        string sql3 = "";
                        if (Type == "GropPackage")
                            sql3 = @"update B_IE_BOMImport set Flag=1,CREATE_TIME=GETDATE(), locked=0 where BOMNum='" + DrawNumber + "'";
                        sql = sql + sql2 + sql3;
                        int m = BaseBuildSql.ExecuteNonQuery(sql);

                        if (m > 0)
                        {
                            XtraMessageBox.Show("保存成功！");
                            return true;

                        }
                        else
                        {
                            XtraMessageBox.Show("保存失败！");
                            return false;
                        }
                    }


                }
                else
                {
                    string sql = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data] 
                     (
                     [DRAWING_NUMBER]
                      ,[CREATE_USER]
                      ,[CREATE_DATE])values( 
                      '" + DrawNumber + @"'
                      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
                      ,GETDATE());";
                    string sql2 = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper])
select 
         '" + DrawNumber + @"'
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
      ,'2'
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO] 
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
from [LamexMESManager].[dbo].[B_IE_Operation_Data] where 1=1";
                    string sql3 = "";
                    if (Type == "Stander")
                        sql3 = @"update B_IE_SJData_Import set Flag=1,CREATE_TIME=GETDATE(),locked=0 where DRAWING_NO_STANDARD='" + DrawNumber + "'";
                    else if (Type == "SJ")
                    {
                        string drawsql = @"select Drawing_No from [LamexMESManager].[dbo].[B_IE_SJR_DATA] where PartNo='" + DrawNumber + "' ";
                        string draw = "";
                        if (BaseBuildSql.GetDataTableBySql(drawsql).Rows.Count>0)
                        {
                            draw=BaseBuildSql.GetDataTableBySql(drawsql).Rows[0][0].ToString();
                        }
                        sql = sql2 + " and DRAWING_NUMBER='" + draw + "' ;";
                        sql3 = @"update [LamexMESManager].[dbo].[B_IE_SJR_DATA] set Flag=1 where PartNo='" + DrawNumber + "'";
                    }
                    else if (Type == "GropPackage")
                        sql3 = @"update B_IE_BOMImport set Flag=1,CREATE_TIME=GETDATE(), locked=0 where BOMNum='" + DrawNumber + "'";
                    sql = sql + sql3;
                    int m = BaseBuildSql.ExecuteNonQuery(sql);

                    if (m > 0)
                    {
                        //XtraMessageBox.Show("保存成功！");
                        //因为临时表没有数据，所以要同步标准图纸号的数据过来
                      
                        return true;

                    }
                    else
                    {
                        //XtraMessageBox.Show("保存失败！");
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }

        }
        public void Claer()
        {
            tableLayoutPanel1.Controls.Clear();
        }
        public void SaveTempSJ(string PartNo, string Drawing)
        {
            string sql = @"select DRAWING_NUMBER from [LamexMESManager].[dbo].[B_IE_Operation_Data_TempSJ] where DRAWING_NUMBER = '" + PartNo + "' ";
            if (BaseBuildSql.GetDataTableBySql(sql).Rows.Count <= 0)
            {
                // BaseBuildSql.ExecuteNonQuery("DELETE from [LamexMESManager].[dbo].[B_IE_Operation_Data_TempSJ] where DRAWING_NUMBER = '" + PartNo + "' ");
                string sql2 = @"INSERT INTO LamexMESManager.[dbo].[B_IE_Operation_Data_TempSJ] 
                     (
                     [DRAWING_NUMBER]
      ,[CREATE_USER]
      ,[CREATE_DATE]
      ,[FLAG]
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	   ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO]
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper])
select 
         '" + PartNo + @"'
      ,'" + Lamex.Common.Loginer.CurrentUser.Account + @"'
      ,GETDATE()
      ,'2'
      ,[COMPONENT_TYPE]
      ,[EDGE_THICKNESS]
       ,[D11_Drilling_vertical_blind_hole]
      ,[D11_Drilling_vertical_through_hole]
      ,[D11_Drilling_Vertical_Sleeve_Hole]
      ,[D11_Drilling_horizontal_front_hole]
      ,[D11_Drilling_Horizontal_Rear_Hole]
      ,[D11_Horizontal_drilling]
      ,[D11_Drilling_Horizontal_Downhole]
      ,[D11_Round_Gong_45_blind_hole]
      ,[D11_Round_Gong_45_through_hole]
      ,[D11_Round_Gong_70_blind_hole]
      ,[D11_Round_Gong_70_through_hole]
      ,[D11_Round_Gong_71_blind_hole]
      ,[D11_Round_Gong_71_through_hole]
      ,[D11_Number_of_special_gongs]
      ,[D11_Length_of_Special_shaped_Gong]
      ,[D11_Width_of_Special_shaped_Gong]
      ,[D11_Gong_lock_block_hole]
      ,[D11_Gong_handle_hole]
      ,[D11_Number_of_sawblade_grooves]
      ,[D11_Saw_blade_groove_length]
      ,[D11_Width_of_saw_blade_groove]
      ,[D24_Coefficient_Width_W1]
      ,[D24_Coefficient_Width_W2]
      ,[D24_Coefficient_Depth_D1]
      ,[D24_Coefficient_Depth_D2]
      ,[D24_Coefficient_Rotation_Angle_Z]
      ,[D24_Plate_Surface_Gong_Notch]
      ,[D24_Plate_Surface_Gong_Roundness]
      ,[D24_Plate_Surface_Cutting_and_Sealing_Angle]
      ,[D24_Seal_Linear_Edge]
      ,[D24_Gong_Plane_Blind_Groove]
      ,[D24_Gong_Plane_Groove]
      ,[D24_Drilling_Vertical_Blind_Hole]
      ,[D24_Drilling_Vertical_Through_Hole]
      ,[D24_Drilling_The_Closure_Hole]
      ,[D24_Drilling_Flat_Reamer]
      ,[D24_Groove_Side_Rubbing]
      ,[D24_Copper_Head_Plug]
      ,[D24_Twisted_Tooth_Nut]
      ,[D24_LOGO]
      ,[D24_General_Label]
      ,[D24_Packing_Brush_Strip]
      ,[D27_Spray_Glue_And_Tincture]
      ,[D27_Lock_Block_Screw]
      ,[D27_Loaded_L_Type_Tape]
      ,[D27_Fittings_For_Door_Tongue]
      ,[D27_Door_Tape]
      ,[D27_Copper_Head_Rubber_Plug]
      ,[D27_Twisted_Tooth_Nut]
      ,[D27_Groove_Side_Rubbing]
      ,[D27_General_Label]
      ,[D27_Paste_White_Adhesive_Paper]
      ,[D27_LOGO]
      ,[D27_Lock_Self_Tapping_Screw]
      ,[D27_Double_Sided_Adhesive_Paper]
      ,[D27_Mounting_Screen_Hanging_Code]
      ,[D27_Decorative_Hole_Cover]
      ,[D31_Seal_Straight_Line_Edge]
      ,[D34_Component_Type]
      ,[D34_Edge_Thickness]
      ,[D34_Coefficient_Width_W1]
      ,[D34_Coefficient_Width_W2]
      ,[D34_Coefficient_Depth_D1]
      ,[D34_Coefficient_Depth_D2]
      ,[D34_Coefficient_Angle_Z]
      ,[D34_Inside_the_Seal_700]
      ,[D34_Inside_the_Seal_701]
      ,[D34_Seal_Outer_Ear_200]
      ,[D34_Seal_Outer_Ear_400]
      ,[D34_Seal_Outer_Ear_401]
      ,[D34_Outside_Seal_300]
      ,[D34_Outside_Seal_500]
      ,[D34_Outside_Seal_501]
      ,[D34_Groove_Side_Rubbing]
      ,[D34_Copper_Head_Plug]
      ,[D34_Twisted_Tooth_Nut]
      ,[D34_LOGO]
      ,[D34_Mounting_Screen_Hanging_Code]
      ,[D37_Wash_Brush_Board]
      ,[D37_Drilling_Hinge]
      ,[D37_Mounted_Countertop_Flat_Hinge]
      ,[D41_Coefficient_Width_W1]
      ,[D41_Coefficient_Width_W2]
      ,[D41_Coefficient_Depth_D1]
      ,[D41_Coefficient_Depth_D2]
      ,[D41_Coefficient_Angle_Z]
      ,[D41_Installation_Of_Door_Tape]
      ,[D41_L_Type_Tape]
      ,[D41_Plate_Thickness_Cut_Slope]
      ,[D41_Shape_Of_Plate_Gong]
      ,[D41_Slab_Bevel_Angle]
      ,[D41_Gong_Plane_Blind_Groove]
      ,[D41_Gong_Lock_Slot_Side]
      ,[D41_Gong_Lock_Plate_Groove_Flat]
      ,[D41_Drilling_Vertical_Blind_Hole]
      ,[D41_Drilling_Vertical_Through_Hole]
      ,[D41_Drilling_Horizontal_Side_Hole]
      ,[D41_Copper_Head_Plug]
      ,[D41_Twisted_Tooth_Nut]
      ,[D41_General_Label]
      ,[D41_Slot_Side_Scrubbing]
      ,[D41_Lock_Tapping_Screw]
      ,[D41_Paste_White_Adhesive_Paper]
      ,[D41_LOGO]
      ,[D41_Double_Sided_Adhesive_Paper]
      ,[D41_Mounting_Screen_Hanging_Code]
      ,[D41_Decorative_Hole_Cover]
      ,[D21_Component_Type]
      ,[D21_Coefficient_Breadth_W1]
      ,[D21_Coefficient_Breadth_W2]
      ,[D21_Outer_Notch_of_Gong_400]
      ,[D21_Outer_Notch_of_Gong_401]
      ,[D21_Drilling_Vertical_Faces]
      ,[D21_Drilling_Horizontal_Face]
      ,[D21_Round_Gong_80_Holes]
      ,[D21_Round_Gong_81_Holes]
      ,[D21_Gong_Inverted_Plate_500]
      ,[D21_Gong_Inverted_Plate_501]
      ,[D21_Gong_Flange_Reaming]
      ,[D21_Number_of_Special_Gongs]
      ,[D21_Length_of_Special_shaped_Gong]
      ,[D21_Width_of_Special_shaped_Gong]
      ,[D21_Gong_Lock_Block_Hole]
      ,[D21_Gong_Handle_Through_Hole]
      ,[D21_Number_of_Sawblade_Grooves]
      ,[D21_Saw_blade_Groove_Length]
      ,[D21_Saw_blade_Groove_Width]
      ,[D28_Sealing_Diagonal_Edge]
      ,[D29_Seal_Straight_Line_Edge]
      ,[D30_Drilling_vertical_blind_hole]
      ,[D30_Drilling_vertical_through_hole]
      ,[D30_Drilling_Vertical_Sleeve_Hole]
      ,[D30_Drilling_horizontal_front_hole]
      ,[D30_Drilling_Horizontal_Rear_Hole]
      ,[D30_Horizontal_drilling]
      ,[D30_Drilling_Horizontal_Downhole]
      ,[D30_Round_Gong_45_blind_hole]
      ,[D30_Round_Gong_45_through_hole]
      ,[D30_Round_Gong_70_blind_hole]
      ,[D30_Round_Gong_70_through_hole]
      ,[D30_Round_Gong_71_blind_hole]
      ,[D30_Round_Gong_71_through_hole]
      ,[D30_Number_of_special_gongs]
      ,[D30_Length_of_Special_shaped_Gong]
      ,[D30_Width_of_Special_shaped_Gong]
      ,[D30_Gong_lock_block_hole]
      ,[D30_Gong_handle_hole]
      ,[D30_Number_of_sawblade_grooves]
      ,[D30_Saw_blade_groove_length]
      ,[D30_Width_of_saw_blade_groove]
      ,[D32_Component_Type]
      ,[D32_Coefficient_Breadth_W1]
      ,[D32_Coefficient_Breadth_W2]
      ,[D32_Outer_Notch_of_Gong_400]
      ,[D32_Outer_Notch_of_Gong_401]
      ,[D32_Drilling_Vertical_Faces]
      ,[D32_Drilling_Horizontal_Face]
      ,[D32_Round_Gong_80_Holes]
      ,[D32_Round_Gong_81_Holes]
      ,[D32_Gong_Inverted_Plate_500]
      ,[D32_Gong_Inverted_Plate_501]
      ,[D32_Gong_Flange_Reaming]
      ,[D32_Number_of_Special_Gongs]
      ,[D32_Length_of_Special_shaped_Gong]
      ,[D32_Width_of_Special_shaped_Gong]
      ,[D32_Gong_Lock_Block_Hole]
      ,[D32_Gong_Handle_Through_Hole]
      ,[D32_Number_of_Sawblade_Grooves]
      ,[D32_Saw_blade_Groove_Length]
      ,[D32_Saw_blade_Groove_Width]
	  ,[D24_Plate_Thickness_Cut_Slope]
	  ,[D34_DecorateKongGai]
      ,[D34_Decorative_Hole_Cover]
      ,[D37_Copper_Head_Rubber_Plug]
      ,[D37_Twisted_Tooth_Nut]
      ,[D37_Decorative_Hole_Cover]
      ,[D37_LOGO] 
,[D41_Fittings_For_Door_Tongue]
,[D34_General_Label]
,[D34_Paste_White_Adhesive_Paper]
,[D34_Lock_Self_Tapping_Screw]
,[D34_Double_Sided_Adhesive_Paper]
from [LamexMESManager].[dbo].[B_IE_Operation_Data] where 1=1 and DRAWING_NUMBER='" + Drawing + "' ";

                int m = BaseBuildSql.ExecuteNonQuery(sql2);

            }
        }

    }
}
